package cn.zz.veggie.application.helper;

import cn.hutool.core.util.ObjUtil;
import cn.zz.comm.exception.classes.AccountPasswordErrorException;
import cn.zz.veggie.model.domain.User;

/**
 * @author zhongq
 * @since 2024/3/20
 */
public class UserHelper {

	/**
	 * check user login
	 * 
	 * @param user
	 *            user
	 * @param password
	 *            password
	 */
	public static void requireCheckLogin(User user, String password) {
		if (ObjUtil.isNull(user)) {
			throw new AccountPasswordErrorException();
		}
		if (!password.equals(user.getPassword())) {
			throw new AccountPasswordErrorException();
		}
	}

}